.x-checkbox {
  cursor: pointer;
  margin-right: 10px;

  &:hover {
    span::before {
      border-color: @primary;
    }
  }

  &.x-checkbox-disabled {
    cursor: not-allowed;
  }

  span {
    display: inline-block;
    padding-left: 6px;
    position: relative;
    font-weight: normal;

    &::before {
      content: "";
      background-color: @white;
      border-radius: 2px;
      border: 1px solid darken(@border, 10%);
      display: inline-block;
      left: 0;
      margin-left: -15px;
      position: absolute;
      transition: 0.3s ease-in-out;
      width: 16px;
      height: 16px;
      outline: none !important;
    }

    &::after {
      color: @border;
      display: inline-block;
      font-size: 11px;
      height: 16px;
      left: 0;
      margin-left: -16px;
      position: absolute;
      top: 0;
      width: 16px;
    }
  }

  input[type="checkbox"] {
    cursor: pointer;
    opacity: 0;
    z-index: 1;
    outline: none !important;

    &:disabled+span {
      opacity: 0.65;
    }
  }

  input[type="checkbox"]:focus+span {
    &::before {
      outline-offset: -2px;
      outline: none;
    }
  }

  &.x-checkbox-checked {
    input[type="checkbox"]+span {
      &::after {
        content: "";
        position: absolute;
        top: 3px;
        left: 7px;
        display: table;
        width: 4px;
        height: 8px;
        border: 1px solid @border;
        border-top-width: 0;
        border-left-width: 0;
        transform: rotate(45deg);
        border-color: @white;
      }

      &::before {
        background-color: @primary;
        border-color: @primary;
      }
    }

    &.x-checkbox-disabled {
      input[type="checkbox"]+span {
        &::before {
          background-color: @primary;
          border-color: @primary;
          cursor: not-allowed;
        }
      }
    }
  }

  &.x-checkbox-disabled {
    input[type="checkbox"]+span {
      &::before {
        background-color: fade(@border, 30%);
        border-color: @border;
        cursor: not-allowed;
      }
    }
  }
}